# -*- conding:UTF-8 -*-

'''
@ Project: P7_project
@ File: create_flask.py
@ Author: 罗婷
@ Date：2022/5/27 14:47

'''
from flask import Flask
from flask_cors import CORS

from common.utils.jwt_auth import jwt_authentication
from models import db
from views.user import user_bp


def create_flask_app(info):
    app = Flask(__name__)
    app.config.from_object(info)
    # 蓝图 项目初始化
    app.register_blueprint(user_bp)
    db.init_app(app)
    CORS(app)
    # 使用钩子方法 验证
    app.before_request(jwt_authentication)
    return app


